//------------------------------------------------------------------------------ 
//      Copyright (c) 2005-2008, Be Nanashi-San 
// 
//      Permission is hereby granted, free of charge, to any person obtaining a 
//      copy of this software and associated documentation files (the "Software"), 
//      to deal in the Software without restriction, including without limitation 
//      the rights to use, copy, modify, merge, publish, distribute, sublicense, 
//      and/or sell copies of the Software, and to permit persons to whom the 
//      Software is furnished to do so, subject to the following conditions: 
// 
//      The above copyright notice and this permission notice shall be included in 
//      all copies or substantial portions of the Software. 
// 
//      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
//      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
//      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
//      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
//      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
//      FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
//      DEALINGS IN THE SOFTWARE. 
// 
//      File Name:	PrefWindow.h
//      Author: 	Be Nanashi-San 
//      Description:	 
//------------------------------------------------------------------------------
#ifndef PREF_WINDOW_H_INCLUDED
#define PREF_WINDOW_H_INCLUDED

#include "Dialog.h"

class BMenuField;
class BRadioButton;
class BTabView;
class PrefWindow : public Dialog 
{
public:
	PrefWindow(); 
	virtual ~PrefWindow(); 
	virtual void MessageReceived(BMessage *message);
	virtual bool QuitRequested();
	const char* FindMessage(const char *label){return fClone.FindString(label);}

private:
	void DispatchButton(BMessage *msg);

	void ModifiedMessage(BMessage *msg);

	void CloneMessage();
	void DeleteCloneMessage();
	void UpdateMessage(BMessage *msg);
	BMessage* DiffMessage(BMessage *dst);
	void ButtonEnable(bool flags);
	
	bool fChanged;
	BMessage fClone;
	BTabView* fTabView;
};

class PrefView : public BView 
{
public:
	PrefView(BRect frame, const char *name); 
	virtual ~PrefView() {};

	void CreateMenuField(BRect frame, const char *label, BMenu *menu);
	void MakeTextField(BRect r,  const char *name, const char *label, uint32 command, float divide);
	void MakeRadioButton(BRect r,  const char *name, const char *label, uint32 command);
	void MakeButton(BRect r, const char *label, uint32 command, bool b=true);
	void MakeCheckBox(BRect r,  const char *name, const char *label, uint32 command);
	void SetMarkeMenuField(int32 id, const char *value);
	void SetTextField(int32 id, const char *value);
	void SetRadioButton(int32 id, const char *value);
	void SetCheckBox(int32 id, const char *value);
};

class ConnectionPrefs : public PrefView 
{
public:
	ConnectionPrefs(BRect frame); 
	virtual ~ConnectionPrefs() {};
	void AllAttached();
};

class DisplayPrefs : public PrefView 
{
public:
	DisplayPrefs(BRect frame); 
	virtual ~DisplayPrefs() {}; 
	void AllAttached();
};

class CachePrefs : public PrefView 
{
public:
	CachePrefs(BRect frame); 
	virtual ~CachePrefs() {}; 
	void AllAttached();
};

#endif //PREF_WINDOW_H_INCLUDED
